package ru.jexp.rcp.supply.handlers;

import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.handlers.IHandlerService;

public final class CommandUtil {
	public static final void executeCommand(IWorkbenchPartSite site,
			String idCommand) {
		executeCommand(site, idCommand, null);
	}
	
	public static final void executeCommand(IWorkbenchPartSite site,
			String idCommand, Event event) {
		IHandlerService handlerService = (IHandlerService) site
				.getService(IHandlerService.class);
		try {
			handlerService.executeCommand(idCommand, event);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}
